import pytest
from api.region_data_api import Region_Api
from api.login_api import Mepsking_Login
from common.utils import read_json
class IdName:
    def id(self):
        login=Mepsking_Login()
        region=Region_Api()
        login_json_dict = {"password": "802545ba4ec603304d87afa3d818bf9a", "username": "2524726232@qq.com"}
        token = login.token(login_json_dict)
        data= read_json('region')
        a = []
        for i in data:
            id = region.country_id(i, token)
            a.append(id)
        print('最终获取到的id为：{}'.format(a))
        return a
    def name(self):
        login = Mepsking_Login()
        region = Region_Api()
        login_json_dict = {"password": "802545ba4ec603304d87afa3d818bf9a", "username": "2524726232@qq.com"}
        token = login.token(login_json_dict)
        data= read_json('region')
        b=[]
        for y in data:
            name=region.region_name(y,token)
            b.append(name)
        country_name=','.join(b)
        print('最终获取到的国家名称为：{}'.format(country_name))
        return country_name
if __name__ == '__main__':
    test=IdName()
    login_dict={"password": "802545ba4ec603304d87afa3d818bf9a", "username": "2524726232@qq.com"}
    test.name()






